﻿using System;
using System.Collections.Generic;
using System.Text;
using HAVNet.Core.String;


namespace HAVNet.Intros.AST
{
    public class ASTNamespaceNamespace : ASTNamespaceMemberDecl
    {
        public string                               name                    { get; set; }
        public readonly ASTUsings                   usings                  = new ASTUsings();
        public readonly ASTExternAliasDirectives    externalAliasDirectives = new ASTExternAliasDirectives();

        public override string ToString ()
        {
            depth += 1;

            string sChildren = (this.namespaceMemberDecls.Count > 0) ?
                this.namespaceMemberDecls.ToString() + Environment.NewLine : "";

            string sExternals = (this.externalAliasDirectives.Count > 0) ?
                Strings.tab(depth) + externalAliasDirectives.ToString() + Environment.NewLine : "";

            string sUsings = (this.usings.Count > 0) ?
                usings.ToString2(depth+1) + Environment.NewLine : "";

            string todo = 
                Strings.tab(depth) + "namespace " + name + Environment.NewLine +
                Strings.tab(depth) + "{" + Environment.NewLine +
                sExternals +
                sUsings    +
                sChildren  +
                Strings.tab(depth) + "}";

            depth -= 1;

            return todo;
        }
    }
}

